import { reqGetPayInfo } from "@/api"
const state = {
    payInfo:{}
}
const actions = {
    // 点击立即支付
    async getPayInfo({commit},tradeId){
        const result = await reqGetPayInfo(tradeId)
        if(result.code===200) {
            commit('GETPAYINFO',result.data)
            return 'ok'
        }else return Promise.reject(new Error('fail'))
    }
}
const mutations = {
    GETPAYINFO(state,data){
        state.payInfo = data
    }
}
const getters = {
    payInfo:state=>state.payInfo
}
export default { state, actions, mutations, getters }